package com.chinacoal.microservice;


import com.chinacoal.microservice.fallback.TenantManagementClientFallback;
import com.chinacoal.microservice.pojo.CcmsSmartleasingTenant;
import com.chinacoal.microservice.util.QueryCriteria;
import com.chinacoal.microservice.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zhuliang
 * @version V1.0
 * @Description: 运维模块-租户管理-对外发布的接口类
 * @date 2020-11-18 14：32
 */
@Api(tags = {"运维模块-租户管理"})
@FeignClient(name = "${spring.application.name}",fallback = TenantManagementClientFallback.class,configuration = FeignAutoConfiguration.class)
public interface TenantManagementClient {

    /**
     * @Description: 查询所有的租户信息（带分页）
     * @author zhuliang
     * @date 2020/11/18 14:39
     */
    @ApiOperation(value = "查询所有的租户信息（带分页）")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "queryCriteria", value = "查询条件实体类", required = true, dataType = "QueryCriteria"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/tenantManagement/getAllTenant")
    public Result<List<CcmsSmartleasingTenant>> getAllTenant(@RequestBody QueryCriteria queryCriteria,
                                                             @RequestHeader("token") String token);

    /**
     * @Description: 根据租户id查询对应的租户信息
     * @author zhuliang
     * @date 2020/11/18 17:14
     */
    @ApiOperation(value = "根据租户id查询对应的租户信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "pkTenantId", value = "租户id", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/tenantManagement/getTenantById/{pkTenantId}")
    public Result<CcmsSmartleasingTenant> getTenantById(@PathVariable(value = "pkTenantId") String pkTenantId,
                                                        @RequestHeader("token") String token);

    /**
     * @Description: 修改租户信息
     * @author zhuliang
     * @date 2020/11/18 17:19
     */
    @ApiOperation(value = "修改租户信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "tenant", value = "租户信息实体类", required = true, dataType = "CcmsSmartleasingTenant"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PutMapping("smartleasing/tenantManagement/updateTenant")
    public Result updateTenant(@RequestBody CcmsSmartleasingTenant tenant,
                               @RequestHeader("token") String token);

    /**
     * @Description: 批量删除租户信息
     * @author zhuliang
     * @date 2020/11/18 17:27
     */
    @ApiOperation(value = "批量删除租户信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "deleteId", value = "要删除的id字符串", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @DeleteMapping("smartleasing/tenantManagement/deleteTenant/{deleteId}")
    public Result deleteTenant(@PathVariable(value = "deleteId",required = false) String deleteId,
                               @RequestHeader("token") String token);

    /**
     * @Description: 条件查询租户信息（带分页）
     * @author zhuliang
     * @date 2020/11/18 17:42
     */
    @ApiOperation(value = "条件查询租户信息（带分页）")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "queryCriteria", value = "查询条件", required = true, dataType = "QueryCriteria"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/tenantManagement/getAllTenantByCondition")
    public Result<List<CcmsSmartleasingTenant>> getAllTenantByCondition(@RequestBody QueryCriteria queryCriteria,
                                                                        @RequestHeader("token") String token);
    
    /**
     * @Description: 重置租户密码
     * @author zhuliang
     * @date 2021/1/7 18:57
     */
    @ApiOperation(value = "重置租户密码")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "pkTenantId", value = "租户id", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "contactPhone", value = "租户联系电话", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/tenantManagement/resetPassword")
    public Result resetPassword(@RequestParam(value = "pkTenantId") String pkTenantId,
                                @RequestParam(value = "contactPhone") String contactPhone,
                                @RequestHeader("token") String token);
}
